{% extends "base.html" %}

{% block content %}
<div class="container-fluid">
    <div class="card">
        <div class="card-header">
            <h5 class="mb-0"><i class="fas fa-plus me-2"></i>添加设备</h5>
        </div>
        <div class="card-body">
            <form method="POST" action="{{ url_for('device.device_add') }}">
                <div class="mb-3">
                    <label for="device_id" class="form-label">设备ID</label>
                    <input type="text" class="form-control" id="device_id" name="device_id" required>
                </div>
                <div class="mb-3">
                    <label for="name" class="form-label">设备名称</label>
                    <input type="text" class="form-control" id="name" name="name" required>
                </div>
                <div class="mb-3">
                    <label for="device_type" class="form-label">设备类型</label>
                    <select class="form-select" id="device_type" name="device_type" required>
                        <option value="">请选择设备类型</option>
                        <option value="sensor">传感器</option>
                        <option value="pump">水泵</option>
                        <option value="valve">阀门</option>
                        <option value="meter">流量计</option>
                        <option value="other">其他</option>
                    </select>
                </div>
                <div class="mb-3">
                    <label for="location" class="form-label">设备位置</label>
                    <input type="text" class="form-control" id="location" name="location" required>
                </div>
                <div class="mb-3">
                    <label for="description" class="form-label">设备描述</label>
                    <textarea class="form-control" id="description" name="description" rows="3"></textarea>
                </div>
                <div class="d-flex justify-content-between">
                    <a href="{{ url_for('device.device_list') }}" class="btn btn-secondary">
                        <i class="fas fa-arrow-left me-1"></i>返回
                    </a>
                    <button type="submit" class="btn btn-primary">
                        <i class="fas fa-save me-1"></i>保存
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
{% endblock %} 